﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using XNALibrary;

namespace XNALibrary
{
    public abstract class CustomEffect
    {
        #region Variables

        protected Effect effect;
        //bool m_bTexture = false;
        Texture2D m_Texture;

        #endregion

        #region Properties

        public Effect CustEffect
        {
            get { return effect; }
            set { effect = value; }
        }

        public Texture2D ModelTexture
        {
            get { return m_Texture; }
            set 
            { 
                m_Texture = value; 

                if(effect != null && effect.Parameters["Texture"] != null)
                    effect.Parameters["Texture"].SetValue(value);
                if(effect != null && effect.Parameters["TextureEnabled"] != null)
                    effect.Parameters["TextureEnabled"].SetValue(true);
            }
        }
        
        #endregion

        #region Constructor

        public CustomEffect(Effect oEffect)
        {
            effect = oEffect;
            m_Texture = null;
        }

        #endregion

        #region Public Methods

        abstract public void SetupParameters();

        abstract public void Update();

        abstract public void DrawEffect(RigidBody body, RenderControl rc);

        #endregion

        #region Private Methods

        #endregion

    }
}
